home *** CD-ROM | disk | FTP | other *** search
- DBCHAR title[81];
- DBCHAR price[9];
-
- /* read the query into the command buffer */
- dbcmd(dbproc, "select title, price, royalty from pubs..titles");
-
- /* send the query to \*S */
- dbsqlexec(dbproc);
-
- /* get ready to process the results of the query */
- dbresults(dbproc);
-
- /* process each row */
- while (dbnextrow(dbproc) != NO_MORE_ROWS)
- {
- /* the first dbconvert() adds a null terminator to the string */
- dbconvert(dbproc, SYBCHAR, (dbdata(dbproc,1)), (dbdatlen(dbproc,1)),
- SYBCHAR, title, (DBINT)-1);
- /* the second dbconvert() converts money to string */
- dbconvert(dbproc, SYBMONEY, (dbdata(dbproc,2)), (DBINT)-1, SYBCHAR, price, (DBINT)-1);
-
- if (dbdatlen(dbproc,3) != 0)
- printf ("%s\en $%s %ld\en", title, price, *((DBINT *)dbdata(dbproc,3)));
- }
-